/**
 * 角色管理
 */
import request from 'utils/request.js'

/**
 * 查询所有角色信息
 * @param {*} params 
 * @returns 
 */
export const findRoleList = (params) => {
  return request({
    url:'/role/list',
    method:'GET',
    params
  })
}

/**
 * 查询当前角色的功能树(菜单)
 * @param {*} _id 
 * @returns 
 */
export const findFunctionsByRoleId = (_id) => {
  return request({
    url:'/role/functions',
    method:'GET',
    params:{
      _id
    }
  })
}

/**
 * 给当前角色授权
 * @param {*} _id 当前角色id
 * @param {*} functionsId 菜单id，多个用逗号隔开
 * @returns 
 */
export const assignFunctions = (_id,functionsId) => {
  return request({
    url:'/role/assignFunctions',
    method:'POST',
    data:{
      _id,functionsId
    }
  })
}
